package com.tuling.service;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

@Aspect
@Component
public class C {
    @Pointcut("execution(public * com.tuling.service.*.*(..))")
    public void myAnnotationPointcut(){

    }

    @Before("myAnnotationPointcut()")
    public void before(JoinPoint joinPoint){
        System.out.println(joinPoint.getTarget() + " begin:" + System.currentTimeMillis());
    }

    @After("myAnnotationPointcut()")
    public void after(JoinPoint joinPoint){
        System.out.println(joinPoint.getTarget() + " end:" + System.currentTimeMillis());
    }
}
